Skip to content

fix: use dedicated L1 account for bot bridge resume tests to avoid nonce race#21148

Merged
alexghr merged 1 commit intomerge-train/spartanfrom
claudebox/fix-flaky-e2e-bot-test
Mar 6, 2026
Merged

fix: use dedicated L1 account for bot bridge resume tests to avoid nonce race#21148
alexghr merged 1 commit intomerge-train/spartanfrom
claudebox/fix-flaky-e2e-bot-test

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 4, 2026

Summary

  • The "bridge resume" tests in e2e_bot.test.ts were using l1Mnemonic with the hardhat default mnemonic (account index 0), which is the same L1 account the sequencer uses for block proposals
  • This caused a flaky nonce-too-low error when the sequencer sent an L1 transaction between the bot's mint and approve calls
  • Fix: use l1PrivateKey from account index 7 (a dedicated, unused index) instead

Test plan

  • The flaky test "does not reuse prior bridge claims if recipient address changes" should no longer fail with nonce-too-low errors
  • Other bot tests using indices 8 and 9 are unaffected

ClaudeBox log: http://ci.aztec-labs.com/7cffb2ae9eb6b324-1

@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 4, 2026
@ludamad ludamad added the ci-draft Run CI on draft PRs. label Mar 4, 2026
@ludamad ludamad changed the base branch from next to merge-train/spartan March 5, 2026 00:27
@ludamad ludamad marked this pull request as ready for review March 5, 2026 22:12
@alexghr alexghr force-pushed the claudebox/fix-flaky-e2e-bot-test branch from 55329f2 to 95d05c4 Compare March 6, 2026 09:18
@alexghr alexghr enabled auto-merge (squash) March 6, 2026 09:18
@alexghr alexghr merged commit 8d93316 into merge-train/spartan Mar 6, 2026
10 checks passed
@alexghr alexghr deleted the claudebox/fix-flaky-e2e-bot-test branch March 6, 2026 09:33
github-merge-queue bot pushed a commit that referenced this pull request Mar 6, 2026
BEGIN_COMMIT_OVERRIDE
test: update proving-real test to mbps (#20991)
chore: epoch proving log analyzer (#21033)
chore: update pause script to allow resume (#21032)
feat: price bump for RPC transaction replacement (#20806)
refactor: remove update checker, retain version checks (#20898)
fix: (A-592) p2p client proposal tx collector test (#20998)
refactor: use publishers-per-pod in deployments (#21039)
chore: web3signer refreshes keystore (#21045)
feat(sequencer): set block building limits from checkpoint limits
(#20974)
chore(e2e): fix e2e bot L1 tx nonce reuse (#21052)
feat: Update L1 to L2 message APIs (#20913)
fix: (A-589) epochs l1 reorgs test (#20999)
feat(sequencer): add SEQ_MAX_TX_PER_CHECKPOINT config (#21016)
fix: drop --pid=host from docker_isolate (#21081)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler
(#21105)
feat(validator): add VALIDATOR_ env vars for independent block limits
(#21060)
refactor(p2p): decouple proposal validators from base class via
composition (#21075)
feat: additional validation in public setup allowlist (onlySelf + null
msg sender) (#21122)
fix: (A-591) aztecProofSubmissionEpochs incorrectly named as
aztecProofSubmissionWindow (#21108)
refactor(sequencer): rename SEQ_GAS_PER_BLOCK_ALLOCATION_MULTIPLIER to
SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER (#21125)
fix: unbound variable in check_doc_references.sh with set -u (#21126)
feat: calldata length validation of public setup function allowlist
(#21139)
fix: include mismatched values in tx metadata validation errors (#21147)
feat: single-node implementation of slash-protection signer (#20894)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
chore: More updated Alpha configuration (#21155)
chore: tally slashing pruning improvements (#21161)
fix: update dependencies (#20997)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker
(#21169)
refactor(p2p): (A-588) maintain sorted array in tx pool instead of
sorting on read (#21079)
fix(p2p): report most severe failure in runValidations (#21185)
fix: use dedicated L1 account for bot bridge resume tests to avoid nonce
race (#21148)
fix: parse error.message in formatViemError (#21163)
fix: bump lighthouse consensus client v7.1.0 -> v8.0.1 (#21170)
chore: code decuplication + refactor (public setup allowlist) (#21200)
END_COMMIT_OVERRIDE
AztecBot added a commit that referenced this pull request Mar 13, 2026
 #20992 #21148)

BEGIN_COMMIT_OVERRIDE
fix: set wallet minFeePadding in BotFactory constructor (#20992)
fix: increase minFeePadding in e2e_bot bridge resume tests and harden GasFees.mul() (#20962)
fix: use dedicated L1 account for bot bridge resume tests to avoid nonce race (#21148)
fix: remove stale fee snapshot from BotFactory account deployment
END_COMMIT_OVERRIDE

Backports three fixes from next and adds a fourth:

1. BotFactory constructor now calls wallet.setMinFeePadding() so all
   setup transactions (token deploy, minting) use the configured padding
   instead of the wallet default (0.5x). (#20992)

2. GasFees.mul() uses bigint arithmetic for integer scalars to avoid
   precision loss, and Math.ceil for non-integer scalars. (#20962)

3. Bridge resume tests use a dedicated L1 private key (index 7) instead
   of the default mnemonic shared with the sequencer, avoiding nonce
   races on approve/deposit calls. (#21148)

4. Remove explicit maxFeesPerGas snapshot from setupAccountWithPrivateKey.
   Let the wallet re-estimate fees at send() time via completeFeeOptions(),
   making the fee estimate fresh and 10x padding sufficient.
ludamad added a commit that referenced this pull request Mar 13, 2026
 #20992 #21148) (#21465)

## Summary

Backports three fixes from `next` and adds a fourth to stabilize the
flaky `e2e_bot` test on `v4-next`.

**Root cause:** The `BotFactory` was snapshotting `maxFeesPerGas` once
during account setup, then using that stale value for subsequent
transactions. L1 baseFee escalation on anvil (from rapid block building)
caused fees to exceed the stale cap.

### Changes

1. **BotFactory constructor sets wallet fee padding** (backport of
#20992)
- Calls `wallet.setMinFeePadding(config.minFeePadding)` so all setup
transactions use the configured padding instead of the wallet default
(0.5x)

2. **GasFees.mul() precision fix** (backport of #20962)
   - Uses bigint arithmetic for integer scalars to avoid precision loss
- Uses `Math.ceil` for non-integer scalars to ensure fees always round
up

3. **Dedicated L1 account for bridge resume tests** (backport of #21148)
- Uses private key index 7 instead of the default mnemonic (shared with
the sequencer)
   - Avoids nonce races on approve/deposit calls in `bridgeL1FeeJuice`
- Uses `getPrivateKey()` helper with auto-incrementing index for other
tests

4. **Remove stale fee snapshot** (new, also in #21464 on `next`)
- Removes explicit `maxFeesPerGas` snapshot from
`setupAccountWithPrivateKey`
- Lets the wallet re-estimate fees at `send()` time via
`completeFeeOptions()`
- Fresh estimation + 10x padding is sufficient since fee change within 1
block is minimal

Related: A-648, #21453

ClaudeBox log: https://claudebox.work/s/c64a6207b95c4a16?run=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants